﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ADONt
{
    class Program
    {
        static void Main(string[] args)
        {
            //数据库信息
            var conString= "server=.;database=SchoolDB;uid=sa;pwd=123456";
            //创建数据库对象
            SqlConnection sqlConnection = new SqlConnection(conString);
            //链接数据库
            sqlConnection.Open();

            SqlCommand sqlCommand = new SqlCommand("select * from Student",sqlConnection);

            var reader=sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine("{0}\t{1}",reader["Id"],reader["Name"]);
            }
            
        }
    }
}
